﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using AMStudio.Windows.Forms;
using AMStudio.Common;

namespace AMStudio.UserInterface
{
    public partial class StationUI11 : StationUI
    {
        public StationUI11()
        {
            this.UIName = "StationUI11";
            //this.StationIndex = 11;
            InitializeComponent();
        }
        
        protected override void BackGroud_EventHandler(object sender, AMStudio.DelegateDispather.StationEventArgs e)
        {
            base.BackGroud_EventHandler(sender, e);
            if (e.From == MachineConfig.Default.St11Scanner.HardwareName)
            {
                if (e.Command == "DATA_RECEIVE")
                {
                    this.txtCurrentHousingScanner.Text = e.Value.ToString();
                }
            }
        }
        
        private void StationUI11_Load(object sender, EventArgs e)
        {
            base.SubscribeEvent("MANAGER_RET");
            base.SubscribeEvent("St11Scanner_Ret");
        }
        protected override void SetUserPrivilige(object sender, EventArgs e)
        {
            base.SetUserPrivilige(sender, e);
            User current = UserDB.CurrentLoginUser;
            //Control[] findCtl = null;
            switch (current.AuthorizationSet)
            {
                case 0:
                    this.tabItemMaintenace.Visible = true;
                    this.tabItemConfiguration.Visible = true;
                    this.tabItemRFTag.Visible = true;
                    this.tabItemIput.Visible = true;
                    //this.tabItemOutput.Visible = true;
                    break;
                case 1:
                    this.tabItemMaintenace.Visible = true;
                    this.tabItemConfiguration.Visible = false;
                    this.tabItemRFTag.Visible = false;
                    this.tabItemIput.Visible = false;
                    //this.tabItemOutput.Visible = false;
                    break;
                case 2:
                default:
                    this.tabItemMaintenace.Visible = false;
                    this.tabItemConfiguration.Visible = false;
                    this.tabItemRFTag.Visible = false;
                    this.tabItemIput.Visible = false;
                    //this.tabItemOutput.Visible = false;
                    break;
            }
        }
    }
}
